<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%--<%@ taglib prefix="s" uri="/struts-tags" %>--%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
    <meta name="description" content=""/>
    <meta name="author" content=""/>
    <title></title>
    <!--favicon-->
    <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
    <!-- simplebar CSS-->
    <link href="assets/plugins/simplebar/css/simplebar.css" rel="stylesheet"/>
    <!-- Bootstrap core CSS-->
    <link href="assets/css/bootstrap.min.css" rel="stylesheet"/>
    <!--Data Tables -->
    <link href="assets/plugins/bootstrap-datatable/css/dataTables.bootstrap4.min.css" rel="stylesheet" type="text/css">
    <link href="assets/plugins/bootstrap-datatable/css/buttons.bootstrap4.min.css" rel="stylesheet" type="text/css">
    <!-- animate CSS-->
    <link href="assets/css/animate.css" rel="stylesheet" type="text/css"/>
    <!-- Icons CSS-->
    <link href="assets/css/icons.css" rel="stylesheet" type="text/css"/>
    <!-- Sidebar CSS-->
    <link href="assets/css/sidebar-menu.css" rel="stylesheet"/>
    <!-- Custom Style-->
    <link href="assets/css/app-style.css" rel="stylesheet"/>
    <script type="text/javascript">
        function aa(tno, tname, tel) {
            document.getElementById("tno").value = tno;
            document.getElementById("tname").value = tname;
            document.getElementById("tel").value = tel;


        }
    </script>
</head>

<body>
<div id="container-fluid" class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <div class="card">
                <div class="card-header"><i class="fa fa-table"></i> 教师基础信息表1</div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table id="example" class="table table-bordered">
                            <thead>
                            <b>
                                <tr>
                                    <th style="width: 30px;">教工号</th>
                                    <th style="width: 30px;">教师姓名</th>
                                    <th style="width: 30px;">联系电话</th>
                                    <th >操作</th>
                                </tr>
                            </b>
                            </thead>
                            <tbody>
                            <!--描述：表开始 -->
                            <c:forEach items="${list}" var="teacher">
                                <tr>
                                    <td>${teacher.tno}</td>
                                    <td>${teacher.tname}</td>
                                    <td>${teacher.tel}</td>
                                    <td style="width: 0px;;">
                                        <div style="width: 1px;">
                                                <%--                        		<button type="button" class="btn btn-info waves-effect waves btn-sm" style="margin: 0px auto;" onclick="XiuGai('${tno}','${tname}','${tel}')" >修改</button>--%>
                                            <div class="profile-card-ctr">
                                                <!-- 模态框（Modal） -->
                                                <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                                                     aria-labelledby="myModalLabel" aria-hidden="true">
                                                    <div class="modal-dialog">
                                                        <div class="modal-content">
                                                            <div class="modal-header">
                                                                <h4 class="modal-title" id="myModalLabel">修改教师信息</h4>
                                                            </div>
                                                            <div class="modal-body">
                                                                <form action="updateteacher" method="post">
                                                                    <input readonly="readonly" class="form-control"
                                                                           name="tno" id="tno" value="${teacher.tno}">
                                                                    <input name="tname" class="form-control" type="text"
                                                                           id="tname" value="${teacher.tname}"
                                                                           placeholder="请输入姓名">
                                                                    <input maxlength="11"
                                                                           onkeyup="value=value.replace(/[^(\d)]/g,'')"
                                                                           name="tel" class="form-control" type="tel"
                                                                           id="tel" value="${teacher.tel }"
                                                                           placeholder="请输入电话号码">
                                                                    <button type="submit" class="btn btn-primary">提交更改
                                                                    </button>
                                                                </form>

                                                            </div>
                                                            <div class="modal-footer">
                                                                <button type="button" class="btn btn-default"
                                                                        data-dismiss="modal">关闭
                                                                </button>

                                                            </div>
                                                        </div><!-- /.modal-content -->
                                                    </div><!-- /.modal -->
                                                </div>

                                            </div>
                                            <button class="btn btn-primary btn-lg waves-effect waves btn-sm"
                                                    data-toggle="modal" data-target="#myModal" style="margin: 0px auto;"
                                                    onclick="aa('${teacher.tno}','${teacher.tname}','${teacher.tel}')">
                                                修改
                                            </button>
                                            <button type="button" class="btn btn-warning waves-effect waves btn-sm"
                                                    style="margin: 0px auto; " onclick="sweet('${teacher.tno}')">删除
                                            </button>
                                        </div>
                                    </td>
                                </tr>
                            </c:forEach>

                            <!--	描述：表结束 -->
                            </tbody>

                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div><!-- End Row-->


</div>


<!-- Bootstrap core JavaScript-->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>

<!-- simplebar js -->
<script src="assets/plugins/simplebar/js/simplebar.js"></script>
<!-- sidebar-menu js -->
<script src="assets/js/sidebar-menu.js"></script>

<!-- Custom scripts -->
<script src="assets/js/app-script.js"></script>

<!--Data Tables js-->
<script src="assets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/dataTables.buttons.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.bootstrap4.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/jszip.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/pdfmake.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/vfs_fonts.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.html5.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.print.min.js"></script>
<script src="assets/plugins/bootstrap-datatable/js/buttons.colVis.min.js"></script>

<!--Sweet Alerts -->
<script src="assets/plugins/alerts-boxes/js/sweetalert.min.js"></script>

<%--    <script>														//上面的打印条件--%>
<%--     $(document).ready(function() {--%>
<%--      //Default data table--%>
<%--       $('#default-datatable').DataTable();--%>


<%--       var table = $('#example').DataTable( {--%>
<%--        lengthChange: false,--%>
<%--        buttons: [ 'copy', 'excel', 'pdf', 'print', 'colvis' ]--%>
<%--      } );--%>
<%-- --%>
<%--     table.buttons().container()--%>
<%--        .appendTo( '#example_wrapper .col-md-6:eq(0)' );--%>
<%--      --%>
<%--      } );--%>

<%--    </script>--%>
<script>
    function sweet(data) {
        swal({
            title: "您确定吗?",			//弹出标题
            text: "该操作会删除该教师信息!",			//弹出文本
            icon: "warning",				//警告图标   还有success error  info  不填就是不显示，默认不显示
            buttons: true,
            dangerMode: true,
        })
            .then((willDelete) => {
                if (willDelete) {
                    swal("你的文件已删除", {
                        icon: "success",
                    });

                    window.location.href = "delteacher?tno=" + data; 	//直接跳转到首页
                    //嵌成果方法
                } else {
                    swal("文件删除失败!");
                    //嵌失败方法
                }
            });
    }

    function CkPro(id) {
        document.getElementById(id).remove();
    }
</script>

</body>
</html>
